package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.mapper.CreditTaskMapper;
import com.ruoyi.system.domain.CreditTask;
import com.ruoyi.system.service.ICreditTaskService;

/**
 * 提升任务Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-28
 */
@Service
public class CreditTaskServiceImpl implements ICreditTaskService 
{
    @Autowired
    private CreditTaskMapper creditTaskMapper;

    /**
     * 查询提升任务
     * 
     * @param taskId 提升任务主键
     * @return 提升任务
     */
    @Override
    public CreditTask selectCreditTaskByTaskId(Long taskId)
    {
        return creditTaskMapper.selectCreditTaskByTaskId(taskId);
    }

    /**
     * 查询提升任务列表
     * 
     * @param creditTask 提升任务
     * @return 提升任务
     */
    @Override
    public List<CreditTask> selectCreditTaskList(CreditTask creditTask)
    {
        return creditTaskMapper.selectCreditTaskList(creditTask);
    }

    /**
     * 新增提升任务
     * 
     * @param creditTask 提升任务
     * @return 结果
     */
    @Override
    public int insertCreditTask(CreditTask creditTask)
    {
        creditTask.setCreateTime(DateUtils.getNowDate());
        return creditTaskMapper.insertCreditTask(creditTask);
    }

    /**
     * 修改提升任务
     * 
     * @param creditTask 提升任务
     * @return 结果
     */
    @Override
    public int updateCreditTask(CreditTask creditTask)
    {
        creditTask.setUpdateTime(DateUtils.getNowDate());
        return creditTaskMapper.updateCreditTask(creditTask);
    }

    /**
     * 批量删除提升任务
     * 
     * @param taskIds 需要删除的提升任务主键
     * @return 结果
     */
    @Override
    public int deleteCreditTaskByTaskIds(Long[] taskIds)
    {
        return creditTaskMapper.deleteCreditTaskByTaskIds(taskIds);
    }

    /**
     * 删除提升任务信息
     * 
     * @param taskId 提升任务主键
     * @return 结果
     */
    @Override
    public int deleteCreditTaskByTaskId(Long taskId)
    {
        return creditTaskMapper.deleteCreditTaskByTaskId(taskId);
    }

    /**
     * 查询可用的提升任务列表
     * 
     * @param taskType 任务类型
     * @return 提升任务集合
     */
    @Override
    public List<CreditTask> selectAvailableCreditTaskList(String taskType)
    {
        return creditTaskMapper.selectAvailableCreditTaskList(taskType);
    }
} 